From d221119d149b74fd2a998196f3719fb4779a3ac4 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 19 Nov 2015 20:23:44 +0100 Subject: [PATCH] wayland: Implement GdkDevice::window_at_position for touch This goes through its own master pointer, so look up the pointer emulating touch focus window and coordinates. --- gdk/wayland/gdkdevice-wayland.c | 41 ++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index 58f5b9ef77..cce562e905 100644 --- a/gdk/wayland/gdkdevice-wayland.c +++ b/gdk/wayland/gdkdevice-wayland.c @@ -595,16 +595,45 @@ gdk_wayland_device_window_at_position (GdkDevice *device, gboolean get_toplevel) { GdkWaylandDeviceData *wd; + GdkWindow *window = NULL; wd = GDK_WAYLAND_DEVICE(device)->device; - if (win_x) - *win_x = wd->surface_x; - if (win_y) - *win_y = wd->surface_y; + + if (device == wd->master_pointer) + { + if (win_x) + *win_x = wd->surface_x; + if (win_y) + *win_y = wd->surface_y; + + if (mask) + *mask |= wd->button_modifiers; + + window = wd->pointer_focus; + } + else if (device == wd->touch_master) + { + GdkWaylandTouchData *touch; + + touch = GDK_WAYLAND_DEVICE(device)->emulating_touch; + + if (touch) + { + if (win_x) + *win_x = touch->x; + if (win_y) + *win_y = touch->y; + if (mask) + *mask |= GDK_BUTTON1_MASK; + + window = touch->window; + } + } + if (mask) - *mask = wd->button_modifiers | wd->key_modifiers; + *mask = wd->key_modifiers; - return wd->pointer_focus; + return window; } static void -- 2.30.2